package com.fantastic.web.controller.app;

import com.fantastic.common.exception.enums.RespStatusInfo;
import com.fantastic.common.result.ResultData;
import com.fantastic.model.pojo.zjs.OrderDetails;
import com.fantastic.service.lwf.impl.OrderDetailsInfoServiceImpl;
import com.fantastic.service.zjs.OrderDetailsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: rxx
 * @since: 2024/6/6 11:14
 * @description: 订单详情信息请求控制器
 */
@RestController
@RequestMapping("/app")
public class OrderDetailsController {

    @Resource
    private OrderDetailsService orderDetailsService;

    @Resource
    private OrderDetailsInfoServiceImpl orderDetailsInfoService;
    /**
     * 查询单个账号的所有订单详情信息
     *
     * @param orderDetails
     * @return
     */
    @GetMapping("/listOrderDetailsApp")
    public ResultData listOrderDetailsApp(OrderDetails orderDetails) {
        return new ResultData(RespStatusInfo.OK, orderDetailsService.listOrderDetails(orderDetails));
    }

    /**
     * 添加订单详情信息
     *
     * @param orderDetails
     * @return
     */
    @PostMapping("/insertOrderDetailsApp")
    public ResultData insertOrderDetailsApp(OrderDetails orderDetails) {
        return new ResultData(RespStatusInfo.OK, orderDetailsService.insertOrderDetails(orderDetails));
    }

    /**
     * 删除订单详情信息
     *
     * @param orderDetailsId
     * @return
     */
    @PostMapping("/deleteOrderDetailsApp")
    public ResultData deleteOrderDetailsApp(Integer orderDetailsId) {
        return new ResultData(RespStatusInfo.OK, orderDetailsService.deleteOrderDetails(orderDetailsId));
    }

    @GetMapping("/getOrderDetailsByoIdApp")
    public ResultData getOrderDetailsByoIdApp(@RequestParam("oId") String orderId) {
        return new ResultData(RespStatusInfo.OK, orderDetailsInfoService.getOrderDetailsByoId(orderId));
    }

}
